package com.heima.hystrix.controller;

import com.heima.hystrix.service.Hello;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class HelloController {

  @Resource
    private Hello hello;


    public String hello(@PathVariable("id") int id){
        if(id==0){
            throw  new RuntimeException("服务器出错");
        }else{
            return "hello";
        }
    }
}
